
<?php 
include'connecsi.php';
$kode_pesanan=$_POST[kode_pesanan];
$tgl=$_POST[tgl];
$pasien_id=$_POST[pasien_id];
$poli_id=$_POST[poli_id];
$simpan=$_GET[simpan];
$bilang=$_GET[bilang];
?>

<?php
			
			$seleksi  = "SELECT ID_BEROBAT FROM db_berobat ORDER BY ID_BEROBAT DESC";
			$qseleksi = mysql_query($seleksi)
						or die("seleksi nomor gagal " . mysql_error());
			$barisno = mysql_fetch_array($qseleksi);
			?>

<?

$kode_ps=array('0','1','2','3','4','5','6','7','8','9');

shuffle($kode_ps);
reset($kode_ps);

$no=0;
foreach($kode_ps as $line)
{
$kode_pesanan.=strtoupper($line);
$no++;
if (($no >= 5)) break;
} ?>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
<table width="100%" align="center" border="0" cellspacing="1" cellpadding="1" bgcolor="#000000">
<tr><td>
<table width="100%" align="center" border="0" cellspacing="1" cellpadding="1" bgcolor="#ffffff">
<tr><td>
<table width="100%"align="center" border="0" cellspacing="1" cellpadding="1">
  <tr>
	<td></td>
  </tr>
  <tr>
	<td>
	<table width="85%"  border="0" cellspacing="1" cellpadding="1">
	  <tr>
		<td colspan="6">
		<?php
		if($_GET[aksi]=="simpan")
		{
			if((empty($kode_pesanan)) or (empty($tgl)) or (empty($pasien_id))  or (empty($poli_id)))							
			{echo "<script>alert('Lengkapi Form')</script>";
			echo"<meta http-equiv=refresh content=0;URL='home.php?ling=registrasi'>";}
			else
			{
			$proses_3="insert into db_berobat(ID_BEROBAT,TGL_BEROBAT,ID_PASIEN,NAMA_POLI) values ('$kode_pesanan','$tgl','$pasien_id','$poli_id') ";
			$queri_3=mysql_query($proses_3)or die("maaf inputtan gagal");
			if($queri_3)
			{
			echo "<script>alert('Data Masuk Sudah')</script>";echo"<meta http-equiv=refresh content=0;URL='home.php?ling=registrasi'>";
			}
			}
		}
		elseif($_GET[aksi]=="hapus")
		{
			$dihapus=mysql_query("delete from db_berobat where ID_BEROBAT='$bilang' ");
			if($dihapus)
			{ echo"<meta http-equiv=refresh content=0;URL='home.php?ling=registrasi'>"; }
		}	
		?>		</td>
	  </tr>
	  <form action="home.php?ling=registrasi&aksi=simpan" method="post" id="formsign" autocomplete="off">
  <tr>
    <td width="108" height="21">ID Pendaftaran</td>
    <td width="1"><div align="center"><strong>:</strong></div></td>
    <td width="1">&nbsp;</td>
    <td width="505"><? echo $kode_pesanan;?></td>
  </tr>
  <tr>
    <td height="21">Tanggal Daftar</td>
    <td><div align="center"><strong>:</strong></div></td>
    <td>&nbsp;</td>
    <td><input type="text" id="tgl" name="tgl" value="<?php echo date('Y\-m\-d'); ?>" readonly /></td>
  </tr>
  <tr>
    <td height="21">ID Pasien</td>
    <td><strong>:</strong></td>
    <td>&nbsp;</td>
    <td><?php
include'nopas.php';
?></td>
  </tr>
  <tr>
    <td height="24">Poli Tujuan </td>
    <td><div align="center"><strong>:</strong></div></td>
    <td>&nbsp;</td>
    <td><?php
include'pilihpoli.php';
?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="5"><div align="center"><input type="submit" name="submit" value="Simpan">&nbsp;</div></td>
  </tr>
	  </form>
	</table>
	</td>
  </tr>
</table></td></tr>
</table>
</td></tr>
</table>
<table width="100%" bgcolor="#FFFFFF" align="center" border="0" cellspacing="1" cellpadding="1">
  <tr>
    <td colspan="6" bgcolor="#000000"><div align="center" class="style11 style1"><font size="2">Registrasi</font></div></td>
  </tr>
  <tr bgcolor="#D7D5D6">
    <td width="19%" align="center"><font color="d7d5d6">a</font><font color="#FFFFFF">ID</font><font color="d7d5d6">a</font></td>
	<td width="15%" align="center"><font color="d7d5d6">aaa</font><font color="#FFFFFF">TANGGAL</font><font color="d7d5d6">aaa</font></td>
	<td width="15%" align="center"><font color="d7d5d6">a</font><font color="#FFFFFF">ID PASIEN</font><font color="d7d5d6">a</font></td>
    <td width="15%" align="center"><font color="d7d5d6">aaa</font><font color="#FFFFFF">POLI</font><font color="d7d5d6">aaa</font></td>
  
  </tr>
  <?php
	  $ambil1="select * from db_berobat order By ID_BEROBAT ";
	  $ambil2=mysql_query($ambil1)or die("maaf error");
	  while($ambil3=mysql_fetch_array($ambil2)) {
	  ?>
  <tr>
    <td><font><? echo"$ambil3[ID_BEROBAT]";?></font></td>
	<td><font><? echo"$ambil3[TGL_BEROBAT]";?></font></td>
	<td><font><? echo"$ambil3[ID_PASIEN]";?></font></td>
    <td><font><? echo"$ambil3[NAMA_POLI]";?></font></td>
	
  </tr>
  <? } ?>
  <tr>
    <td colspan="6" bgcolor="#000000">&nbsp;</td>
  </tr>
</table>